home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / dvivga9.zip / STRCM2.H < prev    next >
Text File  |  1988-05-30  |  882b  |  34 lines

  1. /* -*-C-*- strcm2.h */
  2. /*-->strcm2*/
  3. /**********************************************************************/
  4. /******************************* strcm2 *******************************/
  5. /**********************************************************************/
  6.  
  7.  
  8. /***********************************************************************
  9.  Compare strings (ignoring case), and return:
  10.     s1>s2:    >0
  11.     s1==s2:  0
  12.     s1<s2:    <0
  13. ***********************************************************************/
  14.  
  15. /* toupper() is supposed to work for all letters, but PCC-20 does it
  16. incorrectly if the argument is not already lowercase; this definition
  17. fixes that. */
  18.  
  19. #define UC(c) (islower(c) ? toupper(c) : c)
  20.  
  21. int
  22. strcm2(s1, s2)
  23. register char *s1, *s2;
  24.  
  25. {
  26.     while ((*s1) && (UC(*s1) == UC(*s2)))
  27.     {
  28.     s1++;
  29.     s2++;
  30.     }
  31.     return((int)(UC(*s1) - UC(*s2)));
  32. }
  33. #undef UC
  34.